function Zeigerdiagramm_Vollpol(U_p, I_s, beta, f_s, L_h, L_so, R_s)
%UNTITLED4 Summary of this function goes here
%   Detailed explanation goes here

omega=2*pi*f_s;


I_ges=I_s*exp(j*beta);
XhIs=j*omega*L_h*I_ges;
XsoIs=j*omega*L_so*I_ges;
RsIs=R_s*I_ges;

Vektor=abs([I_ges;U_p;XhIs;XsoIs;RsIs]);

Max=mean(Vektor);
FontSize=12;

hfig=figure(1);
hold on
%grid on

h=quiver(0,0,0,U_p+20,'Color','k','LineStyle','--');
set(h,'DisplayName','q-Achse')
set(h,'AutoScaleFactor',1)
kopf_anpassen(h, Max/(abs(U_p)+20));

text(5,U_p+5,...
     'q-Achse',...
     'FontSize',FontSize)
 
h=quiver(0,0,20,0,'Color','k','LineStyle','--');
set(h,'DisplayName','d-Achse')
set(h,'AutoScaleFactor',1)
kopf_anpassen(h, Max/20);

text(23,0,...
     'd-Achse',...
     'FontSize',FontSize)

h=quiver(0,0,0,U_p,'Color','k');
set(h,'DisplayName','U_p')
set(h,'AutoScaleFactor',1)
kopf_anpassen(h, Max/abs(U_p));

text(-10,U_p,...
     'U_p',...
     'FontSize',FontSize)

if abs(I_ges)<abs(U_p)
    h=quiver(0,0,real(I_ges),imag(I_ges),'Color','k','LineStyle','-');
    set(h,'DisplayName','I_s')
    set(h,'AutoScaleFactor',1)
    kopf_anpassen(h, Max/abs(I_ges));
    text(0.5*real(I_ges),0.5*imag(I_ges)+5,...
     '  I_s',...
     'FontSize',FontSize)
else
    h=quiver(0,0,0.5*real(I_ges),0.5*imag(I_ges),'Color','k','LineStyle','-');
    set(h,'DisplayName','I_s')
    set(h,'AutoScaleFactor',1)
    kopf_anpassen(h, Max/abs(I_ges));
    text(0.25*real(I_ges),0.25*imag(I_ges),...
    '0.5 I_s',...
    'FontSize',FontSize)
end


if abs(XhIs)>0
    h=quiver(0,U_p,real(XhIs),imag(XhIs),'Color','k');
    set(h,'DisplayName','jX_{h}\cdot I_q')
    set(h,'AutoScaleFactor',1)
    kopf_anpassen(h, Max/abs(XhIs));
    U_akt=j*U_p+XhIs;
    text(real(U_akt)-0.5*real(XhIs)+2,imag(U_akt)-0.5*imag(XhIs),...
         { ' ';'';'jX_{h} I_s'},...
         'FontSize',FontSize)
end

U_akt=j*U_p+XhIs;

U_h=abs(U_akt);

h=quiver(0,0,real(U_akt),imag(U_akt),'Color','k','LineStyle','-');
set(h,'DisplayName','U_h')
set(h,'AutoScaleFactor',1)
kopf_anpassen(h, Max/abs(U_akt));

text(real(U_akt),imag(U_akt),...
     '  U_h',...
     'FontSize',FontSize)

 
h=quiver(real(U_akt),imag(U_akt),real(XsoIs),imag(XsoIs),'Color','k');
set(h,'DisplayName','jX_{s\sigma} I_s')
set(h,'AutoScaleFactor',1)
kopf_anpassen(h, Max/abs(XsoIs));

U_akt=j*U_p+XhIs+XsoIs;

text(real(U_akt)-0.5*real(XsoIs)+2,imag(U_akt)-0.5*imag(XsoIs),...
     'jX_{s\sigma} I_s',...
     'FontSize',FontSize)



h=quiver(real(U_akt),imag(U_akt),real(RsIs),imag(RsIs),'Color','k');
set(h,'DisplayName','R_s I_s')
set(h,'AutoScaleFactor',1)
kopf_anpassen(h, Max/abs(RsIs));

U_akt=j*U_p+XhIs+XsoIs+RsIs;

text(real(U_akt)-0.5*real(RsIs)-5,imag(U_akt)-0.5*imag(RsIs)-5,...
     '  R_s I_s',...
     'FontSize',FontSize)

% h=quiver(0,0,real(U_akt),imag(U_akt),'Color','k');
% set(h,'DisplayName','U_s')
% set(h,'AutoScaleFactor',1)
% kopf_anpassen(h, Max/abs(U_akt));
% 
% text(0.5*real(U_akt),0.5*imag(U_akt),...
%      'U_s',...
%      'FontSize',FontSize)
 
set(hfig,'Position',[100 0 1100 1000])

XLim=get(gca,'XLim');
YLim=get(gca,'YLim');

diffX=XLim(2)-XLim(1);
diffY=YLim(2)-YLim(1);
mittelX=XLim(1)+diffX/2;
mittelY=YLim(1)+diffY/2;

if diffX<diffY
    diffX=diffY;
else
    diffY=diffX;
end

XLim(1)=mittelX-diffX/2;
YLim(1)=mittelY-diffY/2;
XLim(2)=mittelX+diffX/2;
YLim(2)=mittelY+diffY/2;
   
set(gca,'XLim',XLim);
set(gca,'YLim',YLim);

%legend show

end

